package viewcomponents;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JTextField;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

public class SLogoInput extends JTextField
{
	private String myInput;

	public SLogoInput()
	{
		setColumns(20);
		addActionListener(new ActionListener() 
			{
			@Override
			public void actionPerformed (ActionEvent evt) {
				try {
					myInput = getText();
					System.out.println(myInput+"\n"); //
				}
				catch (Exception e) {
					
				}
			}
		});
		
		getDocument().addDocumentListener(new DocumentListener() {

			@Override
			public void changedUpdate(DocumentEvent arg0) {
				updateInput();
				
			}

			@Override
			public void insertUpdate(DocumentEvent arg0) {
				updateInput();
				
			}

			@Override
			public void removeUpdate(DocumentEvent arg0) {
				updateInput();
				
			}
			
			public void updateInput() {
				myInput = getText();
				System.out.println(myInput+"\n"); //
			}
			
		});
	}
	
	public String getInput() {
		return myInput;
	}
	
}
